/**
 * Created by forcht on 2018/7/14.
 */
public class Solution {
    public int singleNumber(int[] A) {
        int resust=0;
        for(int i=0;i<32;i++){
            int sum=0;
            for(int j=0;j<A.length;j++){
                sum+=(A[j]>>i)&1;
            }
            resust|=(sum%3)<<i;
        }
        return resust;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.singleNumber(new int[]{1,1,1,2,2,2,3,3,3,4}));
    }
}
